﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace EBA.Framework
{
    /// <summary>
    /// 插件上下文
    /// </summary>
    public interface IBundleContext : IDisposable
    {
        /// <summary>
        /// 名称
        /// </summary>
        string Name { get; }

        /// <summary>
        /// 对应的插件
        /// </summary>
        IBundle Bundle { get; }

        /// <summary>
        /// 初始化上下文
        /// </summary>
        void Initialize<TBundle>(string runtime, string bundleId, string startupPath) where TBundle:IBundle;

        /// <summary>
        /// 注册服务
        /// </summary>
        /// <typeparam name="TService">服务类型</typeparam>
        /// <param name="service">服务实例</param>
        void RegisterService<TService>(TService service);
     
        /// <summary>
        /// 获取已注册的服务
        /// </summary>
        /// <typeparam name="TService">服务类型</typeparam>
        /// <returns>服务实例</returns>
        TService GetService<TService>();
    }
}
